﻿#pragma once

//实现vtk渲染窗口的功能
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkInteractorStyle.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkInteractorStyleJoystickCamera.h>
#include <vtkInteractorStyleRubberBandZoom.h>
#include <vtkInteractorStyleMultiTouchCamera.h>
#include <vtkInteractorStyleSwitch.h>
#include <vtkSetGet.h>



//继承vtkInteractorStyle类，实现自定义的功能
class MyVtkInteractorStyleZoom:public vtkInteractorStyle
{

public:
    static MyVtkInteractorStyleZoom* New();
    void PrintSelf(ostream& os, vtkIndent indent) override;

    ///@{
    /**
     * Event bindings controlling the effects of pressing mouse buttons
     * or moving the mouse.
     */
    void OnMouseMove() override;
    void OnLeftButtonDown() override;
    void OnLeftButtonUp() override;
    void OnMiddleButtonDown() override;
    void OnMiddleButtonUp() override;
    void OnRightButtonDown() override;
    void OnRightButtonUp() override;
    void OnMouseWheelForward() override;
    void OnMouseWheelBackward() override;
    ///@}

    // These methods for the different interactions in different modes
    // are overridden in subclasses to perform the correct motion. Since
    // they are called by OnTimer, they do not have mouse coord parameters
    // (use interactor's GetEventPosition and GetLastEventPosition)
    void Rotate() override;
    void EndRotate() override;

    void Spin() override;

    void Pan() override;
    void EndPan() override;

    void Dolly() override;
    void EnvironmentRotate() override;

    void SetMotionFactor(double factor)
    {
        this->MotionFactor = factor;
    }

    double GetMotionFactor()
    {
        return this->MotionFactor;
    }


protected:
    MyVtkInteractorStyleZoom();
    ~MyVtkInteractorStyleZoom() override;

    double MotionFactor = 10;

    virtual void Dolly(double factor);

private:
    MyVtkInteractorStyleZoom(const MyVtkInteractorStyleZoom&) = delete;
    void operator=(const MyVtkInteractorStyleZoom&) = delete;
};

